package zx.x.modules.app.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.app.entity.CcpEntity;
import zx.x.modules.app.entity.JqjsEntity;
import zx.x.modules.app.service.CcpService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 车船票
 *
 * @author x
 * @email x
 * @date 2023-09-18 19:01:09
 */
@RestController
@RequestMapping("app/ccp")
public class CcpController {
    @Autowired
    private CcpService ccpService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(CcpEntity c){
        QueryWrapper<CcpEntity> queryWrapper = new QueryWrapper<CcpEntity>();
        queryWrapper.eq("delete_flag","0").eq("sfsj","1");
        Page page = PageHelper.startPage(c.getPage(),c.getLimit());
        List<CcpEntity> list = ccpService.list(queryWrapper);
        return R.ok().put("page", list).put("pages",page.getPages()).put("total",page.getTotal());
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    public R info(Integer id){
		CcpEntity ccp = ccpService.getById(id);
        return R.ok().put("ccp", ccp);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(CcpEntity ccp){
		ccpService.save(ccp);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(CcpEntity ccp){
		ccpService.updateById(ccp);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(Integer id){
		ccpService.removeById(id);
        return R.ok();
    }

}
